import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: wwy
 * Date: 2024-11-22
 * Time: 12:49
 */
public class Test {
    public static void main(String[] args) {
        ArrayList<Integer> arrayList = new ArrayList<>(12);
        arrayList.add(10);
        arrayList.add(10);
        arrayList.add(9);
        arrayList.add(4);
        arrayList.add(5);
        arrayList.add(4);
        List<Integer> list = arrayList.subList(1, 5);
        System.out.println(list);
        list.set(0,99);
        System.out.println(list);
        System.out.println(arrayList);
        for (Integer x:
             arrayList) {
            System.out.print(x+" ");
        }
        System.out.println();
        //迭代器输出
        ListIterator<Integer> a=arrayList.listIterator(arrayList.size());
        while (a.hasPrevious()){
            System.out.print(a.previous()+" ");
        }
    }
}
